﻿<phone:PhoneApplicationPage x:Class="WinSource.Views.SavedArticlePage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                            xmlns:AppBarUtils="clr-namespace:AppBarUtils;assembly=AppBarUtils"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:Converters="clr-namespace:WinSource.Converters"
                            DataContext="{Binding SavedArticleViewModel, Source={StaticResource Locator}}"
                            mc:Ignorable="d"
                            d:DesignHeight="728"
                            d:DesignWidth="480">

  <phone:PhoneApplicationPage.Resources>

    <Converters:AuthorImageConverter x:Key="AuthorImageConverter" />

  </phone:PhoneApplicationPage.Resources>

  <Grid Background="White"
        DataContext="{Binding Article}">

    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <StackPanel>

            <TextBlock FontWeight="Bold"
               Foreground="Black"
               Margin="24,12"
               Style="{StaticResource TextBlockSubTitleStyle}"
               Text="{Binding Title}"
               TextWrapping="Wrap" />

            <StackPanel Margin="24,0"
                  Orientation="Horizontal">

        <Image Height="50"
               HorizontalAlignment="Left"
               Margin="0,0,5,0"
               Source="{Binding Author, Converter={StaticResource AuthorImageConverter}}"
               Stretch="UniformToFill"
               VerticalAlignment="Top"
               Width="50" />

        <StackPanel Margin="0,-2,0,0"
                    VerticalAlignment="Center">

          <TextBlock Style="{StaticResource TextBlockBaseStyle}"
                     Foreground="Black"
                     FontWeight="Bold"
                     Text="{Binding Author}"
                     TextWrapping="Wrap"
                     Width="361" />

          <TextBlock Style="{StaticResource TextBlockBaseStyle}"
                     FontSize="18"
                     Foreground="{StaticResource RedBrush}"
                     Text="{Binding DateDifference}"
                     TextWrapping="Wrap"
                     Width="361" />

        </StackPanel>

      </StackPanel>

      <Border BorderBrush="Black"
              BorderThickness="0.5"
              HorizontalAlignment="Center"
              Margin="0,12,0,12"
              Width="432" />

    </StackPanel>

    <StackPanel Grid.Row="1"
                Margin="20,0,20,0">


      <phone:WebBrowser Background="Transparent"
                        Height="550"
                        HorizontalAlignment="Center"
                        Width="440"
                        x:Name="WebBrowser" />

    </StackPanel>

  </Grid>

  <phone:PhoneApplicationPage.ApplicationBar>

    <shell:ApplicationBar BackgroundColor="{StaticResource RedColor}"
                          ForegroundColor="White"
                          IsVisible="True">

      <shell:ApplicationBarIconButton IconUri="/Assets/Shares/Back.png"
                                      Text="back" />

      <shell:ApplicationBarIconButton IconUri="/Assets/Shares/Email.png"
                                      Text="email" />

      <shell:ApplicationBarIconButton IconUri="/Assets/Shares/Delete.png"
                                      Text="delete" />

      <shell:ApplicationBarIconButton IconUri="/Assets/Shares/Next.png"
                                      Text="next" />

      <shell:ApplicationBar.MenuItems>

        <shell:ApplicationBarMenuItem Text="share..." />

      </shell:ApplicationBar.MenuItems>

    </shell:ApplicationBar>

  </phone:PhoneApplicationPage.ApplicationBar>

  <i:Interaction.Behaviors>

    <AppBarUtils:AppBarItemCommand Id="back"
                                   Command="{Binding PreviousArticleCommand}" />

    <AppBarUtils:AppBarItemCommand Id="email"
                                   Command="{Binding ShareEmailArticleCommand}" />

    <AppBarUtils:AppBarItemCommand Id="delete"
                                   Command="{Binding DeleteSavedArticleCommand}" />

    <AppBarUtils:AppBarItemCommand Id="next"
                                   Command="{Binding NextArticleCommand}" />

    <AppBarUtils:AppBarItemCommand Type="MenuItem"
                                   Id="share..."
                                   Command="{Binding ShareArticleCommand}" />

  </i:Interaction.Behaviors>

</phone:PhoneApplicationPage>